/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Models;

import EntitiesTier.ClIBGE;
import java.util.Arrays;
import java.util.List;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Douglas
 */
public class IBGETableModel extends AbstractTableModel {
    
    private List<ClIBGE> ibge;
    private List<String> colunas;

    @Override
    public int getRowCount() {
        return ibge.size();
    }

    @Override
    public int getColumnCount() {
        return 3;
    }

    @Override
    public Object getValueAt(int lin, int col) {
        ClIBGE ib = ibge.get(lin);
        switch(col)
        {
            case 0 : return ib.getIBGE_CIDADE();
            case 1 : return ib.getIBGE_COD();
            case 2 : return ib.getIBGE_UF();
            default : return "";
        }
        
    }
    
    public IBGETableModel(List<ClIBGE> ibge) throws Exception
    {
       this.ibge = ibge;
       colunas = Arrays.asList("Cidade", "Cod. IBGE", "UF");
    }

    @Override
    public String getColumnName(int column) {
        return colunas.get(column);
    }
    
    
}
